import { Component, OnInit } from '@angular/core';
import {ProblemService} from '../problem.service';

// import { ApiService } from '../../core/services/api.service';

@Component({
  selector: 'app-problem-list',
  templateUrl: './problem-list.component.html',
  standalone: false,
  styleUrls: ['./problem-list.component.css']
})
export class ProblemListComponent implements OnInit {
  problems: any[] = [];

  // constructor(private api: ApiService) {}
  constructor(private problemService: ProblemService) {}

  ngOnInit() {
    // this.api.getProblems().subscribe(
    //   data => this.problems = data,
    //   error => console.error(error)
    // );
    // 获取问题列表数据
    this.problemService.getAllProblems().subscribe(data => {
      this.problems = data;  // 将数据存储在本地变量中
      console.log(this.problems);
    });
  }
}
